/**
 * 
 */
package com.thinkgsp.jxc.model;

import java.io.Serializable;

import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;

/**
 * 单据主体扩展类
 * @author evan
 *
 */
public class BillExtend extends BaseModel implements Serializable {

	private static final long serialVersionUID = -1627715103643916792L;

	protected Long billId;
	protected Integer transferIn;
	protected Integer transferOut;
	private InventoryAdd inInvAdd;
	private InventoryAdd outInvAdd;
		
	/**
	 * 调入地点
	 * @return
	 */
	public InventoryAdd getInInvAdd() {
		return inInvAdd;
	}

	public void setInInvAdd(InventoryAdd inInvAdd) {
		this.inInvAdd = inInvAdd;
		this.transferIn = inInvAdd.getId();
	}

	/**
	 * 调出地点
	 * @return
	 */
	public InventoryAdd getOutInvAdd() {
		return outInvAdd;
	}

	public void setOutInvAdd(InventoryAdd outInvAdd) {
		this.outInvAdd = outInvAdd;
		this.transferOut = outInvAdd.getId();
	}	
		
	/**
	 * 单据ID
	 * @return
	 */
	public Long getBillId() {
		return billId;
	}

	public void setBillId(Long billId) {
		this.billId = billId;
	}
	/**
	 * 调入方
	 * @return
	 */
	public Integer getTransferIn() {
		return transferIn;
	}

	public void setTransferIn(Integer transferIn) {
		this.transferIn = transferIn;
	}

	/**
	 * 调出方
	 * @return
	 */
	public Integer getTransferOut() {
		return transferOut;
	}

	public void setTransferOut(Integer transferOut) {
		this.transferOut = transferOut;
	}	


	/* (non-Javadoc)
	 * @see com.thinkgsp.jxc.model.BaseModel#toString()
	 */
	@Override
	public String toString() {
		ToStringBuilder sb = new ToStringBuilder(this, ToStringStyle.DEFAULT_STYLE);
		sb.append("id",this.billId)
		  .append("transferIn",this.transferIn)
		  .append("transferOut",this.transferOut);
		
		return sb.toString();
	}

	/* (non-Javadoc)
	 * @see com.thinkgsp.jxc.model.BaseModel#equals(java.lang.Object)
	 */
	@Override
	public boolean equals(Object o) {
		if(this == o) {
			return true;
		}
		if(!(o instanceof Bill)) {
			return false;
		}
		final BillExtend be = (BillExtend)o;
		if(billId != null) {
			return billId.equals(be.getBillId());
		} else {
			return be.getBillId() == null;
		}
	}

	/* (non-Javadoc)
	 * @see com.thinkgsp.jxc.model.BaseModel#hashCode()
	 */
	@Override
	public int hashCode() {
		return (this.billId != null ? this.billId.hashCode() : 0);
	}

}
